using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy_MoveState : EnemyStateInGround
{
    public Enemy_MoveState(Enemy enemy, StateMachine stateMachine, string animName) : base(enemy, stateMachine, animName)
    {

    }

    public override void Enter()
    {
        base.Enter();
        if (!enemy.IsGround || enemy.IsWall)
        {
            enemy.Flip();
        }
    }
    public override void Update()
    {
        base.Update();
        enemy.SetVelocity(enemy.GetMoveSpeed() * enemy.facingDir, enemy.rb.velocity.y);
        if (!enemy.IsGround || enemy.IsWall)
        {
            stateMachine.ChangeState(enemy.idleState);
        }
    }
    public override void FixedUpdate()
    {
        base.FixedUpdate();
    }
    public override void Exit()
    {
        base.Exit();
    }
}
